﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using ProjectDAL.Entities;

namespace CodeGenBL.Dto
{
    [DataContract]
    public class UserDto
    {
        [DataMember]
        public int Id { get; set; }
       [DataMember]
        public string UserName { get; set; }
       [DataMember]
        public string Password { get; set; }
       [DataMember]
        public DateTime CreateDate { get; set; }
        [DataMember]
        public DateTime LastLogin { get; set; }
    }
    public static class UserModelExt
    {
        public static User TransformToUserModel(this UserDto userDto)
        {
            return new User
            {
                Id = userDto.Id,
                UserName = userDto.UserName,
                Password = userDto.Password,
                CreateDate = userDto.CreateDate,
                LastLogin = userDto.LastLogin,
                Projects = null
            };
        }
        public static User TransformToUserModel(this AddUserDto addUserDto)
        {
            return new User
            {
                UserName = addUserDto.UserName,
                Password = addUserDto.Password
            };
        }
    }
}
